import { ref } from 'vue';

export const toastOptions = ref({});
//  自定义方法，通过这些方法来操作弹窗
export class Toast { 
  constructor(options = {}) {
    this.setOptions(options);
  }

  setOptions() {
    toastOptions.value = Object.assign({}, toastOptions.value, options);
  }

  show() {  //  展示弹窗
    toastOptions.value.show = true;
  }

  close() { //  关闭弹窗
    toastOptions.value.show = false;
  } 
}





export const loadingOptions = ref({});
//  自定义 loading 图标
export class Loading {
  constructor(options = {}) {
    this.setOptions(options);
  }

  setOptions() {
    loadingOptions.value = Object.assign({}, loadingOptions.value, options);
  }

  show() {  //  展示弹窗
    loadingOptions.value.show = true;
  }

  close() { //  关闭弹窗
    loadingOptions.value.show = false;
  }
}